﻿var atoms;

$(document).ready(function () {
    $('#PDBBrowse').change(PDBChange);

    //Function for reading .pdb files.
    function PDBChange(evt) {
        var file = evt.target.files[0];

        if (!file) {
            alert("Failed to load file");
        }

        else {
            var fr = new FileReader();

            fr.onload = function (evt) {
                var text = evt.target.result;
                atoms = parsePDB(text);

//                for (var i = 0; i < atoms.length; i++) {
//                    alert(atoms[i].resName);
//                }

                $('#display').removeAttr("disabled");
            }

            fr.readAsText(file);
        }

        alert("PDB.js end");
    }
});